package com.glory.wxelectricitypda.adapter;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.glory.wxelectricitypda.R;
import com.glory.wxelectricitypda.bean.DefectCodeBean;

import java.util.List;

public class DefectDataAdapter extends BaseQuickAdapter<DefectCodeBean, BaseViewHolder> {


    public DefectDataAdapter(@Nullable List<DefectCodeBean> data) {
        super(R.layout.item_defect_adapter,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, DefectCodeBean item) {
        helper.setIsRecyclable(false);
        helper.setText(R.id.tvCode,item.getACTIONDESC());
        helper.setText(R.id.tvQty,String.valueOf(item.getQTY()));
        ImageView ivDelete = helper.getView(R.id.ivDelete);
        ivDelete.setOnClickListener(view -> {
            remove(helper.getAdapterPosition());
            notifyDataSetChanged();
        });
    }

}
